package com.example.HoW_Memento;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;


import java.util.List;

public class HomeActivity extends SherlockActivity
{
    ImageButton imageButton;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2nd);

        ActionBar bar = getSupportActionBar();
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setHomeButtonEnabled(true);
        bar.setDisplayShowTitleEnabled(true);
        bar.setTitle("HoW Memento");

        final Button goCardsListButton = (Button)findViewById(R.id.buttoncardslist);
        goCardsListButton.setOnClickListener(
                new View.OnClickListener()
                {
                    public void onClick(View aView)
                    {
                        Intent toAnotherActivity = new Intent(aView.getContext(),CardsListViewActivity.class);
                        startActivityForResult(toAnotherActivity, 0);
                    }
                }
        );

        final Button goHeroesListButton = (Button)findViewById(R.id.buttonheroeslist);
        goHeroesListButton.setOnClickListener(
                new View.OnClickListener()
                {
                    public void onClick(View aView)
                    {
                        Intent toAnotherActivity = new Intent(aView.getContext(),HeroesListActivity.class);
                        startActivityForResult(toAnotherActivity, 0);
                    }
                }
        );


    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        menu.add("Save")
                .setIcon(R.drawable.ic_compose_inverse)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        menu.add("Search")
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

        menu.add("Refresh")
                .setIcon(R.drawable.ic_refresh_inverse)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

        return true;
    }
}
